﻿#region Using directives

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using InvoiceChecking.Entities;
using InvoiceChecking.Data;

#endregion

namespace InvoiceChecking.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="SunJournalVoucherProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract class SunJournalVoucherProviderBaseCore : EntityViewProviderBase<SunJournalVoucher>
	{
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions
		
		/*
		///<summary>
		/// Fill an VList&lt;SunJournalVoucher&gt; From a DataSet
		///</summary>
		/// <param name="dataSet">the DataSet</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList&lt;SunJournalVoucher&gt;"/></returns>
		protected static VList&lt;SunJournalVoucher&gt; Fill(DataSet dataSet, VList<SunJournalVoucher> rows, int start, int pagelen)
		{
			if (dataSet.Tables.Count == 1)
			{
				return Fill(dataSet.Tables[0], rows, start, pagelen);
			}
			else
			{
				return new VList<SunJournalVoucher>();
			}	
		}
		
		
		///<summary>
		/// Fill an VList&lt;SunJournalVoucher&gt; From a DataTable
		///</summary>
		/// <param name="dataTable">the DataTable that hold the data.</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList<SunJournalVoucher>"/></returns>
		protected static VList&lt;SunJournalVoucher&gt; Fill(DataTable dataTable, VList<SunJournalVoucher> rows, int start, int pagelen)
		{
			int recordnum = 0;
			
			System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
			
			while (dataRows.MoveNext() && (pagelen != 0))
			{
				if(recordnum >= start)
				{
					DataRow row = (DataRow)dataRows.Current;
				
					SunJournalVoucher c = new SunJournalVoucher();
					c.TransType = (Convert.IsDBNull(row["TransType"]))?string.Empty:(System.String)row["TransType"];
					c.JeTypeSun = (Convert.IsDBNull(row["JE_Type_SUN"]))?string.Empty:(System.String)row["JE_Type_SUN"];
					c.VoucherNo = (Convert.IsDBNull(row["VoucherNo"]))?string.Empty:(System.String)row["VoucherNo"];
					c.TransactionDt = (Convert.IsDBNull(row["Transaction_dt"]))?DateTime.MinValue:(System.DateTime)row["Transaction_dt"];
					c.Description = (Convert.IsDBNull(row["Description"]))?string.Empty:(System.String)row["Description"];
					c.SunAcctCode = (Convert.IsDBNull(row["SUN_AcctCode"]))?string.Empty:(System.String)row["SUN_AcctCode"];
					c.AmtUsd = (Convert.IsDBNull(row["Amt_USD"]))?0.0m:(System.Decimal?)row["Amt_USD"];
					c.AmtVnd = (Convert.IsDBNull(row["Amt_VND"]))?0.0m:(System.Decimal?)row["Amt_VND"];
					c.DrCrInd = (Convert.IsDBNull(row["DrCr_ind"]))?string.Empty:(System.String)row["DrCr_ind"];
					c.AcctPeriod = (Convert.IsDBNull(row["AcctPeriod"]))?string.Empty:(System.String)row["AcctPeriod"];
					c.T0 = (Convert.IsDBNull(row["T0"]))?string.Empty:(System.String)row["T0"];
					c.T1 = (Convert.IsDBNull(row["T1"]))?string.Empty:(System.String)row["T1"];
					c.T2 = (Convert.IsDBNull(row["T2"]))?string.Empty:(System.String)row["T2"];
					c.T3 = (Convert.IsDBNull(row["T3"]))?string.Empty:(System.String)row["T3"];
					c.T4 = (Convert.IsDBNull(row["T4"]))?string.Empty:(System.String)row["T4"];
					c.T5 = (Convert.IsDBNull(row["T5"]))?string.Empty:(System.String)row["T5"];
					c.T6 = (Convert.IsDBNull(row["T6"]))?string.Empty:(System.String)row["T6"];
					c.T7 = (Convert.IsDBNull(row["T7"]))?string.Empty:(System.String)row["T7"];
					c.T8 = (Convert.IsDBNull(row["T8"]))?string.Empty:(System.String)row["T8"];
					c.ExchgRate = (Convert.IsDBNull(row["ExchgRate"]))?0.0m:(System.Decimal?)row["ExchgRate"];
					c.SunExportDt = (Convert.IsDBNull(row["SUN_Export_Dt"]))?DateTime.MinValue:(System.DateTime)row["SUN_Export_Dt"];
					c.CaseFileNum = (Convert.IsDBNull(row["CaseFileNum"]))?string.Empty:(System.String)row["CaseFileNum"];
					c.PreparedBy = (Convert.IsDBNull(row["PreparedBy"]))?string.Empty:(System.String)row["PreparedBy"];
					c.AcceptChanges();
					rows.Add(c);
					pagelen -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		*/	
						
		///<summary>
		/// Fill an <see cref="VList&lt;SunJournalVoucher&gt;"/> From a DataReader.
		///</summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pageLength">number of row.</param>
		///<returns>a <see cref="VList&lt;SunJournalVoucher&gt;"/></returns>
		protected VList<SunJournalVoucher> Fill(IDataReader reader, VList<SunJournalVoucher> rows, int start, int pageLength)
		{
			int recordnum = 0;
			while (reader.Read() && (pageLength != 0))
			{
				if(recordnum >= start)
				{
					SunJournalVoucher entity = null;
					if (DataRepository.Provider.UseEntityFactory)
					{
						entity = EntityManager.CreateViewEntity<SunJournalVoucher>("SunJournalVoucher",  DataRepository.Provider.EntityCreationalFactoryType); 
					}
					else
					{
						entity = new SunJournalVoucher();
					}
					
					entity.SuppressEntityEvents = true;

					entity.TransType = (reader.IsDBNull(((int)SunJournalVoucherColumn.TransType)))?null:(System.String)reader[((int)SunJournalVoucherColumn.TransType)];
					//entity.TransType = (Convert.IsDBNull(reader["TransType"]))?string.Empty:(System.String)reader["TransType"];
					entity.JeTypeSun = (System.String)reader[((int)SunJournalVoucherColumn.JeTypeSun)];
					//entity.JeTypeSun = (Convert.IsDBNull(reader["JE_Type_SUN"]))?string.Empty:(System.String)reader["JE_Type_SUN"];
					entity.VoucherNo = (reader.IsDBNull(((int)SunJournalVoucherColumn.VoucherNo)))?null:(System.String)reader[((int)SunJournalVoucherColumn.VoucherNo)];
					//entity.VoucherNo = (Convert.IsDBNull(reader["VoucherNo"]))?string.Empty:(System.String)reader["VoucherNo"];
					entity.TransactionDt = (System.DateTime)reader[((int)SunJournalVoucherColumn.TransactionDt)];
					//entity.TransactionDt = (Convert.IsDBNull(reader["Transaction_dt"]))?DateTime.MinValue:(System.DateTime)reader["Transaction_dt"];
					entity.Description = (reader.IsDBNull(((int)SunJournalVoucherColumn.Description)))?null:(System.String)reader[((int)SunJournalVoucherColumn.Description)];
					//entity.Description = (Convert.IsDBNull(reader["Description"]))?string.Empty:(System.String)reader["Description"];
					entity.SunAcctCode = (System.String)reader[((int)SunJournalVoucherColumn.SunAcctCode)];
					//entity.SunAcctCode = (Convert.IsDBNull(reader["SUN_AcctCode"]))?string.Empty:(System.String)reader["SUN_AcctCode"];
					entity.AmtUsd = (reader.IsDBNull(((int)SunJournalVoucherColumn.AmtUsd)))?null:(System.Decimal?)reader[((int)SunJournalVoucherColumn.AmtUsd)];
					//entity.AmtUsd = (Convert.IsDBNull(reader["Amt_USD"]))?0.0m:(System.Decimal?)reader["Amt_USD"];
					entity.AmtVnd = (reader.IsDBNull(((int)SunJournalVoucherColumn.AmtVnd)))?null:(System.Decimal?)reader[((int)SunJournalVoucherColumn.AmtVnd)];
					//entity.AmtVnd = (Convert.IsDBNull(reader["Amt_VND"]))?0.0m:(System.Decimal?)reader["Amt_VND"];
					entity.DrCrInd = (reader.IsDBNull(((int)SunJournalVoucherColumn.DrCrInd)))?null:(System.String)reader[((int)SunJournalVoucherColumn.DrCrInd)];
					//entity.DrCrInd = (Convert.IsDBNull(reader["DrCr_ind"]))?string.Empty:(System.String)reader["DrCr_ind"];
					entity.AcctPeriod = (reader.IsDBNull(((int)SunJournalVoucherColumn.AcctPeriod)))?null:(System.String)reader[((int)SunJournalVoucherColumn.AcctPeriod)];
					//entity.AcctPeriod = (Convert.IsDBNull(reader["AcctPeriod"]))?string.Empty:(System.String)reader["AcctPeriod"];
					entity.T0 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T0)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T0)];
					//entity.T0 = (Convert.IsDBNull(reader["T0"]))?string.Empty:(System.String)reader["T0"];
					entity.T1 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T1)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T1)];
					//entity.T1 = (Convert.IsDBNull(reader["T1"]))?string.Empty:(System.String)reader["T1"];
					entity.T2 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T2)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T2)];
					//entity.T2 = (Convert.IsDBNull(reader["T2"]))?string.Empty:(System.String)reader["T2"];
					entity.T3 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T3)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T3)];
					//entity.T3 = (Convert.IsDBNull(reader["T3"]))?string.Empty:(System.String)reader["T3"];
					entity.T4 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T4)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T4)];
					//entity.T4 = (Convert.IsDBNull(reader["T4"]))?string.Empty:(System.String)reader["T4"];
					entity.T5 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T5)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T5)];
					//entity.T5 = (Convert.IsDBNull(reader["T5"]))?string.Empty:(System.String)reader["T5"];
					entity.T6 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T6)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T6)];
					//entity.T6 = (Convert.IsDBNull(reader["T6"]))?string.Empty:(System.String)reader["T6"];
					entity.T7 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T7)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T7)];
					//entity.T7 = (Convert.IsDBNull(reader["T7"]))?string.Empty:(System.String)reader["T7"];
					entity.T8 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T8)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T8)];
					//entity.T8 = (Convert.IsDBNull(reader["T8"]))?string.Empty:(System.String)reader["T8"];
					entity.ExchgRate = (reader.IsDBNull(((int)SunJournalVoucherColumn.ExchgRate)))?null:(System.Decimal?)reader[((int)SunJournalVoucherColumn.ExchgRate)];
					//entity.ExchgRate = (Convert.IsDBNull(reader["ExchgRate"]))?0.0m:(System.Decimal?)reader["ExchgRate"];
					entity.SunExportDt = (System.DateTime)reader[((int)SunJournalVoucherColumn.SunExportDt)];
					//entity.SunExportDt = (Convert.IsDBNull(reader["SUN_Export_Dt"]))?DateTime.MinValue:(System.DateTime)reader["SUN_Export_Dt"];
					entity.CaseFileNum = (System.String)reader[((int)SunJournalVoucherColumn.CaseFileNum)];
					//entity.CaseFileNum = (Convert.IsDBNull(reader["CaseFileNum"]))?string.Empty:(System.String)reader["CaseFileNum"];
					entity.PreparedBy = (reader.IsDBNull(((int)SunJournalVoucherColumn.PreparedBy)))?null:(System.String)reader[((int)SunJournalVoucherColumn.PreparedBy)];
					//entity.PreparedBy = (Convert.IsDBNull(reader["PreparedBy"]))?string.Empty:(System.String)reader["PreparedBy"];
					entity.AcceptChanges();
					entity.SuppressEntityEvents = false;
					
					rows.Add(entity);
					pageLength -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		
		
		/// <summary>
		/// Refreshes the <see cref="SunJournalVoucher"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="SunJournalVoucher"/> object to refresh.</param>
		protected void RefreshEntity(IDataReader reader, SunJournalVoucher entity)
		{
			reader.Read();
			entity.TransType = (reader.IsDBNull(((int)SunJournalVoucherColumn.TransType)))?null:(System.String)reader[((int)SunJournalVoucherColumn.TransType)];
			//entity.TransType = (Convert.IsDBNull(reader["TransType"]))?string.Empty:(System.String)reader["TransType"];
			entity.JeTypeSun = (System.String)reader[((int)SunJournalVoucherColumn.JeTypeSun)];
			//entity.JeTypeSun = (Convert.IsDBNull(reader["JE_Type_SUN"]))?string.Empty:(System.String)reader["JE_Type_SUN"];
			entity.VoucherNo = (reader.IsDBNull(((int)SunJournalVoucherColumn.VoucherNo)))?null:(System.String)reader[((int)SunJournalVoucherColumn.VoucherNo)];
			//entity.VoucherNo = (Convert.IsDBNull(reader["VoucherNo"]))?string.Empty:(System.String)reader["VoucherNo"];
			entity.TransactionDt = (System.DateTime)reader[((int)SunJournalVoucherColumn.TransactionDt)];
			//entity.TransactionDt = (Convert.IsDBNull(reader["Transaction_dt"]))?DateTime.MinValue:(System.DateTime)reader["Transaction_dt"];
			entity.Description = (reader.IsDBNull(((int)SunJournalVoucherColumn.Description)))?null:(System.String)reader[((int)SunJournalVoucherColumn.Description)];
			//entity.Description = (Convert.IsDBNull(reader["Description"]))?string.Empty:(System.String)reader["Description"];
			entity.SunAcctCode = (System.String)reader[((int)SunJournalVoucherColumn.SunAcctCode)];
			//entity.SunAcctCode = (Convert.IsDBNull(reader["SUN_AcctCode"]))?string.Empty:(System.String)reader["SUN_AcctCode"];
			entity.AmtUsd = (reader.IsDBNull(((int)SunJournalVoucherColumn.AmtUsd)))?null:(System.Decimal?)reader[((int)SunJournalVoucherColumn.AmtUsd)];
			//entity.AmtUsd = (Convert.IsDBNull(reader["Amt_USD"]))?0.0m:(System.Decimal?)reader["Amt_USD"];
			entity.AmtVnd = (reader.IsDBNull(((int)SunJournalVoucherColumn.AmtVnd)))?null:(System.Decimal?)reader[((int)SunJournalVoucherColumn.AmtVnd)];
			//entity.AmtVnd = (Convert.IsDBNull(reader["Amt_VND"]))?0.0m:(System.Decimal?)reader["Amt_VND"];
			entity.DrCrInd = (reader.IsDBNull(((int)SunJournalVoucherColumn.DrCrInd)))?null:(System.String)reader[((int)SunJournalVoucherColumn.DrCrInd)];
			//entity.DrCrInd = (Convert.IsDBNull(reader["DrCr_ind"]))?string.Empty:(System.String)reader["DrCr_ind"];
			entity.AcctPeriod = (reader.IsDBNull(((int)SunJournalVoucherColumn.AcctPeriod)))?null:(System.String)reader[((int)SunJournalVoucherColumn.AcctPeriod)];
			//entity.AcctPeriod = (Convert.IsDBNull(reader["AcctPeriod"]))?string.Empty:(System.String)reader["AcctPeriod"];
			entity.T0 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T0)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T0)];
			//entity.T0 = (Convert.IsDBNull(reader["T0"]))?string.Empty:(System.String)reader["T0"];
			entity.T1 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T1)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T1)];
			//entity.T1 = (Convert.IsDBNull(reader["T1"]))?string.Empty:(System.String)reader["T1"];
			entity.T2 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T2)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T2)];
			//entity.T2 = (Convert.IsDBNull(reader["T2"]))?string.Empty:(System.String)reader["T2"];
			entity.T3 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T3)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T3)];
			//entity.T3 = (Convert.IsDBNull(reader["T3"]))?string.Empty:(System.String)reader["T3"];
			entity.T4 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T4)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T4)];
			//entity.T4 = (Convert.IsDBNull(reader["T4"]))?string.Empty:(System.String)reader["T4"];
			entity.T5 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T5)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T5)];
			//entity.T5 = (Convert.IsDBNull(reader["T5"]))?string.Empty:(System.String)reader["T5"];
			entity.T6 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T6)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T6)];
			//entity.T6 = (Convert.IsDBNull(reader["T6"]))?string.Empty:(System.String)reader["T6"];
			entity.T7 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T7)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T7)];
			//entity.T7 = (Convert.IsDBNull(reader["T7"]))?string.Empty:(System.String)reader["T7"];
			entity.T8 = (reader.IsDBNull(((int)SunJournalVoucherColumn.T8)))?null:(System.String)reader[((int)SunJournalVoucherColumn.T8)];
			//entity.T8 = (Convert.IsDBNull(reader["T8"]))?string.Empty:(System.String)reader["T8"];
			entity.ExchgRate = (reader.IsDBNull(((int)SunJournalVoucherColumn.ExchgRate)))?null:(System.Decimal?)reader[((int)SunJournalVoucherColumn.ExchgRate)];
			//entity.ExchgRate = (Convert.IsDBNull(reader["ExchgRate"]))?0.0m:(System.Decimal?)reader["ExchgRate"];
			entity.SunExportDt = (System.DateTime)reader[((int)SunJournalVoucherColumn.SunExportDt)];
			//entity.SunExportDt = (Convert.IsDBNull(reader["SUN_Export_Dt"]))?DateTime.MinValue:(System.DateTime)reader["SUN_Export_Dt"];
			entity.CaseFileNum = (System.String)reader[((int)SunJournalVoucherColumn.CaseFileNum)];
			//entity.CaseFileNum = (Convert.IsDBNull(reader["CaseFileNum"]))?string.Empty:(System.String)reader["CaseFileNum"];
			entity.PreparedBy = (reader.IsDBNull(((int)SunJournalVoucherColumn.PreparedBy)))?null:(System.String)reader[((int)SunJournalVoucherColumn.PreparedBy)];
			//entity.PreparedBy = (Convert.IsDBNull(reader["PreparedBy"]))?string.Empty:(System.String)reader["PreparedBy"];
			reader.Close();
	
			entity.AcceptChanges();
		}
		
		/*
		/// <summary>
		/// Refreshes the <see cref="SunJournalVoucher"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="SunJournalVoucher"/> object.</param>
		protected static void RefreshEntity(DataSet dataSet, SunJournalVoucher entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.TransType = (Convert.IsDBNull(dataRow["TransType"]))?string.Empty:(System.String)dataRow["TransType"];
			entity.JeTypeSun = (Convert.IsDBNull(dataRow["JE_Type_SUN"]))?string.Empty:(System.String)dataRow["JE_Type_SUN"];
			entity.VoucherNo = (Convert.IsDBNull(dataRow["VoucherNo"]))?string.Empty:(System.String)dataRow["VoucherNo"];
			entity.TransactionDt = (Convert.IsDBNull(dataRow["Transaction_dt"]))?DateTime.MinValue:(System.DateTime)dataRow["Transaction_dt"];
			entity.Description = (Convert.IsDBNull(dataRow["Description"]))?string.Empty:(System.String)dataRow["Description"];
			entity.SunAcctCode = (Convert.IsDBNull(dataRow["SUN_AcctCode"]))?string.Empty:(System.String)dataRow["SUN_AcctCode"];
			entity.AmtUsd = (Convert.IsDBNull(dataRow["Amt_USD"]))?0.0m:(System.Decimal?)dataRow["Amt_USD"];
			entity.AmtVnd = (Convert.IsDBNull(dataRow["Amt_VND"]))?0.0m:(System.Decimal?)dataRow["Amt_VND"];
			entity.DrCrInd = (Convert.IsDBNull(dataRow["DrCr_ind"]))?string.Empty:(System.String)dataRow["DrCr_ind"];
			entity.AcctPeriod = (Convert.IsDBNull(dataRow["AcctPeriod"]))?string.Empty:(System.String)dataRow["AcctPeriod"];
			entity.T0 = (Convert.IsDBNull(dataRow["T0"]))?string.Empty:(System.String)dataRow["T0"];
			entity.T1 = (Convert.IsDBNull(dataRow["T1"]))?string.Empty:(System.String)dataRow["T1"];
			entity.T2 = (Convert.IsDBNull(dataRow["T2"]))?string.Empty:(System.String)dataRow["T2"];
			entity.T3 = (Convert.IsDBNull(dataRow["T3"]))?string.Empty:(System.String)dataRow["T3"];
			entity.T4 = (Convert.IsDBNull(dataRow["T4"]))?string.Empty:(System.String)dataRow["T4"];
			entity.T5 = (Convert.IsDBNull(dataRow["T5"]))?string.Empty:(System.String)dataRow["T5"];
			entity.T6 = (Convert.IsDBNull(dataRow["T6"]))?string.Empty:(System.String)dataRow["T6"];
			entity.T7 = (Convert.IsDBNull(dataRow["T7"]))?string.Empty:(System.String)dataRow["T7"];
			entity.T8 = (Convert.IsDBNull(dataRow["T8"]))?string.Empty:(System.String)dataRow["T8"];
			entity.ExchgRate = (Convert.IsDBNull(dataRow["ExchgRate"]))?0.0m:(System.Decimal?)dataRow["ExchgRate"];
			entity.SunExportDt = (Convert.IsDBNull(dataRow["SUN_Export_Dt"]))?DateTime.MinValue:(System.DateTime)dataRow["SUN_Export_Dt"];
			entity.CaseFileNum = (Convert.IsDBNull(dataRow["CaseFileNum"]))?string.Empty:(System.String)dataRow["CaseFileNum"];
			entity.PreparedBy = (Convert.IsDBNull(dataRow["PreparedBy"]))?string.Empty:(System.String)dataRow["PreparedBy"];
			entity.AcceptChanges();
		}
		*/
			
		#endregion Helper Functions
	}//end class

	#region SunJournalVoucherFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="SunJournalVoucher"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class SunJournalVoucherFilterBuilder : SqlFilterBuilder<SunJournalVoucherColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the SunJournalVoucherFilterBuilder class.
		/// </summary>
		public SunJournalVoucherFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the SunJournalVoucherFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public SunJournalVoucherFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the SunJournalVoucherFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public SunJournalVoucherFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion SunJournalVoucherFilterBuilder

	#region SunJournalVoucherParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="SunJournalVoucher"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class SunJournalVoucherParameterBuilder : ParameterizedSqlFilterBuilder<SunJournalVoucherColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the SunJournalVoucherParameterBuilder class.
		/// </summary>
		public SunJournalVoucherParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the SunJournalVoucherParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public SunJournalVoucherParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the SunJournalVoucherParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public SunJournalVoucherParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion SunJournalVoucherParameterBuilder
	
	#region SunJournalVoucherSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="SunJournalVoucher"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class SunJournalVoucherSortBuilder : SqlSortBuilder<SunJournalVoucherColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the SunJournalVoucherSqlSortBuilder class.
		/// </summary>
		public SunJournalVoucherSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion SunJournalVoucherSortBuilder

} // end namespace
